var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var ResKeeper = require("AA_ResKeeper");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
_decorator.property;

var _def_UI_JianTou = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.sprjian1 = [];
    t.state = 1;
    t.offtime = 0;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    return __awaiter(this, undefined, Promise, function () {
      var e;
      var t;
      var o;
      return __generator(this, function (n) {
        switch (n.label) {
          case 0:
            return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "res/jian1", cc.SpriteFrame)];
          case 1:
            e = n.sent();
            return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "res/jian3", cc.SpriteFrame)];
          case 2:
            t = n.sent();
            return [4, this._loadRes(BundleConfig.BundleNames.Game, "game/" + "res/jian3", cc.SpriteFrame)];
          case 3:
            o = n.sent();
            this.sprjian1.push(e);
            this.sprjian1.push(t);
            this.sprjian1.push(o);
            return [2];
        }
      });
    });
  };
  _creator.prototype.startJianTou = function () {
    return __awaiter(this, undefined, undefined, function () {
      return __generator(this, function () {
        switch (this.state) {
          case 1:
            this.sprjian1[0] && (this.node.children[2].getComponent(cc.Sprite).spriteFrame = this.sprjian1[0]);
            this.sprjian1[2] && (this.node.children[1].getComponent(cc.Sprite).spriteFrame = this.sprjian1[2]);
            this.sprjian1[2] && (this.node.children[0].getComponent(cc.Sprite).spriteFrame = this.sprjian1[2]);
            this.state = 2;
            break;
          case 2:
            this.sprjian1[1] && (this.node.children[2].getComponent(cc.Sprite).spriteFrame = this.sprjian1[1]);
            this.sprjian1[0] && (this.node.children[1].getComponent(cc.Sprite).spriteFrame = this.sprjian1[0]);
            this.sprjian1[2] && (this.node.children[0].getComponent(cc.Sprite).spriteFrame = this.sprjian1[2]);
            this.state = 3;
            break;
          case 3:
            this.sprjian1[2] && (this.node.children[2].getComponent(cc.Sprite).spriteFrame = this.sprjian1[2]);
            this.sprjian1[1] && (this.node.children[1].getComponent(cc.Sprite).spriteFrame = this.sprjian1[1]);
            this.sprjian1[0] && (this.node.children[0].getComponent(cc.Sprite).spriteFrame = this.sprjian1[0]);
            this.state = 1;
        }
        return [2];
      });
    });
  };
  _creator.prototype.update = function (e) {
    this.offtime += e;
    if (this.offtime >= .3) {
      this.offtime = 0;
      this.startJianTou();
    }
  };
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_JianTou;